#include <string>
using namespace std;
class Solution
{
public:
    string removeDuplicates(string s)
    {
        string ans;
        for (auto e : s)
        {
            if (ans.empty() || e != ans.back())
                ans += e;
            else
                ans.pop_back();
        }
        return ans;
    }
};